home *** CD-ROM | disk | FTP | other *** search
- Path: news.res.com!usenet
- From: crunch@res.com
- Newsgroups: comp.lang.c++,comp.os.msdos.programmer
- Subject: Re: Timer (0x1C) Interrupt exactly 18.2 seconds?
- Date: 23 Feb 1996 16:47:51 GMT
- Organization: RES Online
- Message-ID: <4gkr3n$e30@clare.res.com>
- References: <4givrv$cim@midland.co.nz>
- NNTP-Posting-Host: di024.res.com
- X-Newsreader: WinVN 0.92.6+
-
- In article <4givrv$cim@midland.co.nz>, lowefam@igrin.co.nz (Jarrod S Lowe) says:
- >
- >Hi
- >
- >I have a C++ Program (on DOS) in which a function is attached to the
- >Timer (0x1C) Interrupt.
- >
- >The function has a static int to count the number of times it has been
- >called. Every 'x' calls, It executes another function.
- >
- >'x' is 546, which one would expect to result in the function being
- >called every 30 seconds. However, it is called every 29 point
- >something seconds. Over 5 minutes you can see it has drifted. If I had
- >one to 'x' (now 547) it is called every 30 point something seconds -
- >the same problem in reverse.
- >
- >This program is expected to run, continually, for YEARS - so a drift
- >that shows up in 5 minutes will make it unusable.
- >
- >Does anybody have any ideas WHY this is happening?
- >
- >Thanks
- >Jarrod S Lowe
- >(lowefam@igrin.co.nz)
- >
- If interrupts are enabled, the hardware timer interrupt is given highest
- priority. It in turn calls the software interrupt 1ch, which includes
- the code in your program. This interrupt gets called approximately
- 18.2065 times per second. Even this number is not exact.
-